#if 0
#include <robot/robot.h>

#include <robot/pacohead/ccamclient.h>
#include <blackbox/connect.h>

namespace buola { namespace robot { namespace pacohead {

static const int sECamToIndex[16]={-1,0,1,-1,2,-1,-1,-1,3,-1,-1,-1,-1,-1,-1,-1};

CCamClient::CCamClient()
    :   BBox("cam client")
    ,   iFL(this,"FL in")
    ,   iFR(this,"FR in")
    ,   iWL(this,"WL in")
    ,   iWR(this,"WR in")
{
}

CCamClient::~CCamClient()
{
}

void CCamClient::Init(const blackbox::CClientProxy &pClient)
{
    bb_connect(pClient["foveal left"]["image out"],iFL);
    bb_connect(pClient["foveal right"]["image out"],iFR);
    bb_connect(pClient["wide left"]["image out"],iWL);
    bb_connect(pClient["wide right"]["image out"],iWR);

    io::CBinaryReader lWCalStr("/etc/calibration/wide-field");

    img::CStereoParameters lStereo;

    lWCalStr >> lStereo;

    mParameters[0]=lStereo.mLeftInt;
    mParameters[1]=lStereo.mRightInt;

    io::CBinaryReader lFCalStr("/etc/calibration/foveal");

    lFCalStr >> lStereo;

    mParameters[2]=lStereo.mLeftInt;
    mParameters[3]=lStereo.mRightInt;
}

bool CCamClient::IsNextFrameReady(ECam pCams)
{
    if((pCams&CAM_FLEFT)&&!iFL.Changed()) return false;
    if((pCams&CAM_FRIGHT)&&!iFR.Changed()) return false;
    if((pCams&CAM_WLEFT)&&!iWL.Changed()) return false;
    if((pCams&CAM_WRIGHT)&&!iWR.Changed()) return false;
    return true;
}

void CCamClient::WaitNextFrame(ECam pCams)
{
    while(true)
    {
        if(IsNextFrameReady(pCams))
            return;

        usleep(5000);
    }
}

img::CImage_rgb8 CCamClient::GetCurrentImage(ECam pCam)
{
    switch(pCam)
    {
    case CAM_FLEFT:
        return iFL.Get();
    case CAM_FRIGHT:
        return iFR.Get();
    case CAM_WLEFT:
        return iWL.Get();
    case CAM_WRIGHT:
        return iWR.Get();
    default:
        throw std::out_of_range("invalid ECam parameter in GetCurrentImage");
    }
}

const img::CCameraParameters &CCamClient::GetIntrinsicParameters(ECam pCam)
{
    int lCamIndex=sECamToIndex[pCam];

    if(lCamIndex<0)
    {
        throw std::out_of_range("invalid ECam parameter in GetIntrinsicParameters");
    }

    return mParameters[lCamIndex];
}

/*namespace pacohead*/ } /*namespace robot*/ } /*namespace buola*/ }
#endif